﻿@{
    // odd formatting in this file is to cause more attractive results in the output.
    var items = Enumerable.Cast<dynamic>((System.Collections.IEnumerable)Model);
    var classes = (IEnumerable<string>) Model.Classes ?? Enumerable.Empty<string>();
}
@{

    if (Model.Href == "/") {
        @:<li data-ng-class="{active: $uiRoute}" data-ui-route="/?.">
    }
    else {
        @:<li data-ng-class="{active: $uiRoute}" data-ui-route="@Model.Href/?.*">
    }
    

    if (items.Any()) {
            <span title="@Model.Text">
                <i class="@string.Join(" ", classes.ToArray())"></i>
                <span class="nav-title">@Model.Text</span>
            </span>
            <ul class="inner-nav">
                @DisplayChildren(Model)
            </ul>
        }
        else{
            if (Model.Parent.Parent == null) {
                <span title="@Model.Text">
                    <i class="@string.Join(" ", classes.ToArray())"></i>
                    <a href="@Model.Href"  class="nav-title"> @Model.Text</a>
                </span>
            }
            else {
                <a href="@Model.Href"><i class="icol-table"></i> @Model.Text</a>
            }
            
        }
    @:</li>
}